<template>
  <div>
    <div style="height: 100vh; width: 100%">
      <div class="content">
        <AdminHome
          ref="Homeref"
          v-if="active == 0"
          @activeindex="activeindex"
        />
        <WWC v-if="active == 1" />
        <LSDD v-if="active == 2" />
      </div>
      <van-tabbar v-model="active" active-color="#00BAAD" @change="QH">
        <van-tabbar-item icon="home-o">首页</van-tabbar-item>
        <van-tabbar-item icon="warning-o">未完成</van-tabbar-item>
        <van-tabbar-item icon="todo-list-o">历史订单</van-tabbar-item>
      </van-tabbar>
    </div>
  </div>
</template>

<script>
import { getandroidCode } from "../common/auth";
import { setpersonalInformation } from "../common/RYXX";
import { selectUserPhone } from "@/api/realAssets/icsharedstation/home";
import AdminHome from "../AdminPages/home/index.vue";
import WWC from "../AdminPages/WWC/index.vue";
import LSDD from "../AdminPages/LSDD/index.vue";
import { testUserMessage } from "../common/testUser.js";
export default {
  components: { AdminHome, WWC, LSDD },
  data() {
    return {
      versions: "",
      show: false,
      active: 0,
      Homeref: null,
    };
  },
  created() {},
  mounted() {
    testUserMessage("基本急救").then((siteData) => {
      this.GETXX();
    });
  },
  methods: {
    QH(val) {
      // this.active = val;
      // router.push({
      //   name: "i_life_AdminPages",
      //   query: {
      //     id: val,
      //   },
      // });
      // setTimeout(() => {
      //   if (this.Homeref && this.active == 0) {
      //     // console.log(active.value);
      //     this.$refs.Homeref.getYH(); // 调用子组件方法
      //   }
      // }, 0);
    },
    activeindex(val) {
      this.active = val;
    },
    GETXX() {
      console.log(getandroidCode());
      //默认获取用户信息
      selectUserPhone({
        ishid: getandroidCode(), //拿到编码
      }).then((resXX) => {
        if (resXX.data == "用户id错误") {
          this.show = true;
        } else {
          this.versions = resXX.data.versions;
          setpersonalInformation(resXX.data);
          this.$refs.Homeref.queryList(); // 调用子组件方法
        }
      });
    },
  },
};
</script>

<style lang="less" scoped>
.content {
  height: calc(
    var(--real-vh, 1vh) * 100 - 50px - env(safe-area-inset-bottom) -
      env(safe-area-inset-top)
  );
  box-sizing: border-box;
  overflow: hidden;
}
</style>
